Adds the specified key and value to the dictionary.
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Private Sub Add ( _
key As Object, _
value As Object _
) Implements IDictionary.Add |
C# |
---|
void IDictionary.Add(
Object key,
Object value
) |
Parameters
- key
- Type: System..::.Object
The object to use as the key.
- value
- Type: System..::.Object
The object to use as the value.
Implements
IDictionary..::.Add(Object, Object)Exceptions
Exception | Condition |
---|
System..::.ArgumentNullException | key is a null reference
(Nothing in Visual Basic). |
System..::.OverflowException | The dictionary contains too many
elements. |
System..::.ArgumentException |
key is of a type that is not assignable to the key type TKey of the Dictionary<(Of <(TKey, TValue>)>). -or-
value is of a type that is not assignable to TValue,
the type of values in the Dictionary<(Of <(TKey, TValue>)>).
-or- A value with the same key already exists in the Dictionary<(Of <(TKey, TValue>)>).
|
See Also